package com.zt.mapper;

import com.zt.pojo.*;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Mapper
public interface EmpMapper {
    List<Emp> QueryPage(EmpQueryParam empQueryParam);
    void deleteById(Integer[] id);
    void add(Emp emp);
    void addExpr(List<EmpExpr> empExprList);
    void deleteExprById(Integer[] id);
    List<Emp> findAll();
    Emp findById(Integer id);
    @Update("update emp set username = #{username}, password = #{password}, name = #{name}, gender = #{gender}, phone = #{phone}, job = #{job}, salary = #{salary}, image = #{image}, entry_date = #{entryDate}, dept_id = #{deptId},update_time = #{updateTime} where id = #{id} order by update_time")
    void update(Emp emp);
    void updateEmpExpr(EmpExpr expr);
    @Select("select * from emp_expr where emp_id = #{empId}")
    Thread findEmpExprById(Integer empId);
    @Insert("insert into emp_expr values(#{id},#{empId},#{begin},#{end},#{company},#{job})")
    void insertEmpExpr(EmpExpr expr);
    @Select("select if(gender = 1, '男','女') as name, count(*) as value from emp group by gender")
    List<Map<String, Object>> getempGenderDate();
    @MapKey("name")
    List<Map<String, Object>> getEmpJobData();
    @MapKey("name")
    List<Map<String, Object>> getStudentDegreeData();
    @MapKey("clazzList")
    List<Map<String, Object>> getstudentData();
    @Select("select id,username,name from emp where username = #{username} and password = #{password}")
    Logininfo findByUserNameAndPasword(Emp emp);
    @Select("select image from emp")
    Set<String> selectAllImage();
    @Update("update emp set password = #{newPassword}, update_time = now() where id = #{id}")
    void updatePassword(String newPassword, Integer id);
}